package initialize

import (
	"gopkg.in/yaml.v2"
	"io/ioutil"
	"log"
	"user_srv/global"
)

type conf struct {
	Enabled bool   `yaml:"enabled"` //yaml：yaml格式 enabled：属性的为enabled
	Path    string `yaml:"path"`
}

func SetConfig() {
	var c *conf
	yamlFile, err := ioutil.ReadFile("cfg.yaml")
	if err != nil {
		log.Printf("yamlFile.Get err   #%v ", err)
	}
	err = yaml.Unmarshal(yamlFile, c)
	if err != nil {
		log.Fatalf("Unmarshal: %v", err)
	}

	global.MyConfig = c
}
